package megrez.job.custom.web;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import megrez.job.common.NameLabel;
import megrez.job.custom.domain.TaskState;

/**
 * 公用请求
 *  
 * @author Lucky Yang
 * @since 2.6.9
 */
@RestController
@RequestMapping("/v1/commons")
public class CommonResource {
    @GetMapping("/enum")
    public List<NameLabel> getEnum() {
       return Stream.of(TaskState.values()).map(e -> new NameLabel(e.getClass().getName(), e.name(), e.note)).collect(Collectors.toList());
    }
}
